from base.models.travelSpot import travelSport

with open('C:\\Users\\17914\\Desktop\\travelCF\\base\data\\pois.csv', 'r', encoding='utf-8') as file:
    for line in file:
        line = line.strip('\n').split(',')

        if line[0] == '':
            continue
        try:
            data = {
                'name': line[0],
                'poiId': line[3],
                'tags': line[6],
                'score': line[10],
                'img': line[12],
                'brief': line[-2]
            }
            item = travelSport.objects.create(tid=data['poiId'], spot_name=data['name'], spot_score=data['score'],
                                              spot_tags=data['tags'], spot_url=data['img'], spot_brief=data['brief'])
            item.save()
        except:
            pass
        print(data)
